package com.wpx.log.core.handler;

import java.lang.reflect.Field;

import com.wpx.log.core.LogContext;
import com.wpx.log.core.LogRequestContext;
import com.wpx.log.util.Utils;

public class OpExceptionLogHandler implements ILogHandler {

	@Override
	public Object handler(LogContext logContext, LogRequestContext logRequestContext, Field logField) {
		if(logRequestContext.isIpPass() == false) {
			return logRequestContext.getIp()+" ip不允许,已被忽略！";
		}
		
		Throwable exception = logRequestContext.getException();
		if(exception == null) {
			return null;
		}		
		return Utils.getStackTrace(exception);
	}

}
